import Vue from 'vue';
import App from './App.vue';
import './registerServiceWorker';
import VueI18n from 'vue-i18n';
import laguages from './languages';
import ElementLocale from 'element-ui/lib/locale';
import router from './router';
import store from './store';
import { loadDirective } from './directive';
import { loadFilters } from './filters';

import { CheckboxGroup,Checkbox,BreadcrumbItem, Breadcrumb, Badge, Button, ButtonGroup, Carousel, CarouselItem, Cascader, Col, Dialog, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Option, Radio, RadioGroup, Row, Select, Table, TableColumn, TabPane, Tabs, Tag, Upload, Loading, Message, MessageBox, Collapse, CollapseItem, InfiniteScroll, Pagination } from 'element-ui';

import 'normalize.css';
import 'brainy-style';
import './theme/element-variables.scss';
import './assets/font-awesome/scss/font-awesome.scss';

import Login from '@/components/login';

import { init as initFacebook } from '@/utils/facebook';
import VueSocialSharing from 'vue-social-sharing'


initFacebook();

Vue.config.productionTip = false;
Vue.prototype.$ELEMENT = { size: 'large' };
Vue.use(VueSocialSharing);
Vue.use(Button)
  .use(Checkbox)
  .use(CheckboxGroup)
  .use(ButtonGroup)
  .use(Dropdown)
  .use(DropdownMenu)
  .use(DropdownItem)
  .use(Link)
  .use(Row)
  .use(Col)
  .use(Select)
  .use(Cascader)
  .use(Input)
  .use(Table)
  .use(TableColumn)
  .use(Tabs)
  .use(TabPane)
  .use(Option)
  .use(Dialog)
  .use(Form)
  .use(FormItem)
  .use(Upload)
  .use(Carousel)
  .use(CarouselItem)
  .use(Tag)
  .use(RadioGroup)
  .use(Radio)
  .use(Collapse)
  .use(CollapseItem)
  .use(InfiniteScroll)
  .use(Carousel)
  .use(CarouselItem)
  .use(Badge)
  .use(Pagination)
  .use(Breadcrumb)
  .use(BreadcrumbItem)
Vue.prototype.$loading = Loading.service;
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$message = Message;

Vue.use(VueI18n);

Vue.use(Login);

loadDirective(Vue);
loadFilters(Vue);

const i18n = new VueI18n({
  locale: localStorage.getItem('LANGUAGE') || 'pt',
  messages: laguages,
});

ElementLocale.i18n((key, value) => i18n.t(key, value));

window.$lang = i18n;

new Vue({
  router,
  store,
  i18n,
  render: (h) => h(App),
}).$mount('#app');
